package com.ks.BusAlarm;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SearchView extends Activity {

	Button btnSearch;
	Button btnStop;
	EditText editBusStopNum;
	EditText editBusNum;
	Intent service;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.searchview);

		editBusStopNum = (EditText) findViewById(R.id.editBusStopNum);
		editBusNum = (EditText) findViewById(R.id.editBusNum);

		service = new Intent(getApplicationContext(), MyService.class);

		btnSearch = (Button) findViewById(R.id.btn_search);

		btnSearch.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {

				service.putExtra("BusStopNum", editBusStopNum.getText()
						.toString());
				service.putExtra("BusNum", editBusNum.getText().toString());

				startService(service);

			}
		});

		btnStop = (Button) findViewById(R.id.btn_stop);
		btnStop.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {

				Intent ServiceDestroyer = new Intent(getApplicationContext(),
						MyService.class);
				stopService(ServiceDestroyer);

			}
		});

	}

}
